package com.javademo.iotest;

import lombok.extern.slf4j.Slf4j;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;

@Slf4j
public class OutputStreamTest {
    public static void main(String[] args) {
        String data = "hello world! hello world! hello world! hello world! hello world! " +
                "hello world! hello world! hello world! hello world! hello world! hello world! " +
                "hello world! hello world! hello world! hello world! hello world! hello world! " +
                "hello world! hello world! hello world! hello world! ";
        try(OutputStream outputStream = Files.newOutputStream(Paths.get("test.txt"))){
            outputStream.write(data.getBytes());
        } catch (IOException e) {
            log.info("exception: {}", e.getMessage(), e);
        }
    }
}
